package com.shop.entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;

/**
 * ProductCategory entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "product_category", catalog = "myshop")
public class ProductCategory implements java.io.Serializable {

	// Fields

	private Integer epcId;
	private String epcName;
	private Set<Product> products = new HashSet<Product>(0);

	// Constructors

	/** default constructor */
	public ProductCategory() {
	}

	/** minimal constructor */
	public ProductCategory(String epcName) {
		this.epcName = epcName;
	}

	/** full constructor */
	public ProductCategory(String epcName, Set<Product> products) {
		this.epcName = epcName;
		this.products = products;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "increment")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "epc_id", unique = true, nullable = false)
	public Integer getEpcId() {
		return this.epcId;
	}

	public void setEpcId(Integer epcId) {
		this.epcId = epcId;
	}

	@Column(name = "epc_name", nullable = false, length = 20)
	public String getEpcName() {
		return this.epcName;
	}

	public void setEpcName(String epcName) {
		this.epcName = epcName;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "productCategory")
	public Set<Product> getProducts() {
		return this.products;
	}

	public void setProducts(Set<Product> products) {
		this.products = products;
	}

}